import socket

__author__ = 'kirill.bilchenko'
class Application(object):
    def __init__(self, driver):
        self.driver=driver

    def home_page(self):
        self.driver.get("http://"+socket.gethostbyname(socket.gethostname())+"/php4dvd/")

    def login(self,user):
        driver=self.driver
        driver.find_element_by_id("username").clear()
        driver.find_element_by_id("username").send_keys("admin")
        driver.find_element_by_name("password").clear()
        driver.find_element_by_name("password").send_keys("admin")
        driver.find_element_by_name("submit").click()

    def logout(self):
        driver=self.driver
        driver.find_element_by_link_text("Log out").click()
        driver.switch_to_alert().accept()

